package com.ws.exer;
/*
2.利用面向对象的编程方法，设计类Circle计算圆的面积
 */
//测试类
public class CircleTest {
    public static void main(String[] args) {
        Circle circle = new Circle();
        circle.radius = 3;
        double area = circle.findArea();
        System.out.println(area);
        circle.printArea();
    }
}


class Circle {

    //属性
    double radius;

    //求圆的面积
    //方式一
    public double findArea() {
        double area = Math.PI * radius * radius;
        return area;
    }

    //方式二：
    public void printArea() {
        double area = Math.PI * radius * radius;
        System.out.println(area);
    }
}